Repository navigation
Conversation
The color-code Stim builder and the color-code DEM precompute read p_prep_X, p_prep_Z, p_meas_X and p_meas_Z by the applied Pauli (Z-basis reset/measure used the *_X keys), while the surface-code builder, the config comments and the README name a key by the basis that fails (Z-basis reset/measure uses the *_Z keys and is applied as X_ERROR). With a non-uniform noise model the color-code path applied the X-basis rates to the Z basis and vice versa. Move the color-code readers to the surface-code convention: - qec/color_code/memory_circuit.py: add_reset, add_single_error, add_measure_reset, add_measure and the data-readout flip injected in the final round. - qec/precompute_dem.py: build_single_p_marginal_color_code (ancilla prep/meas, data prep and final data-readout entries). Models with p_prep_X == p_prep_Z and p_meas_X == p_meas_Z, which includes every shipped config, produce the same circuits and probability vectors as before. Tests: add test_color_code_prep_meas_key_convention.py and update the two expectations in test_color_augmented_dem_precompute.py that pinned the previous convention. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Ivan Basov <ibasov@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The four prep/meas keys of
data.noise_modelare named by the basis that fails:p_prep_Z/p_meas_Zbelong to Z-basis reset/measurement (applied asX_ERROR),p_prep_X/p_meas_Xto X-basis (applied asZ_ERROR). The surface-code builder,conf/config_public.yamland the README follow this.The color-code path paired them the other way (Z-basis reset/measurement took
p_prep_X/p_meas_X), so a non-uniform noise model had its X-basis and Z-basis rates exchanged. This PR gives the color-code path the same pairing as the surface code. The Pauli applied for each basis is unchanged; only the key that supplies the probability changes.Changes
qec/color_code/memory_circuit.py:add_reset,add_single_error,add_measure_reset,add_measure, and the data-readout flip of the final round.qec/precompute_dem.py:build_single_p_marginal_color_code, so the Torch probability vector keeps matching the Stim circuit.qec/noise_model.py: docstring only.Impact
Behaviour changes only for the color code with
p_prep_X != p_prep_Zorp_meas_X != p_meas_Z; exchange the values within each pair to reproduce earlier results.All configs under
conf/,NoiseModel.from_single_p,NoiseModel.from_si1000and the pretrained models use equal values within each pair. For these the color-code circuit and probability vector are byte-identical before and after (checked at d=5, both bases).Tests
test_color_code_prep_meas_key_convention.py: a single non-zero key produces the expected instruction on the expected qubits; the color builder agrees with the surface builder; the DEM precompute agrees with the Stim circuit. Fails onmain, passes here.test_color_augmented_dem_precompute.py, which pinned the old pairing with four distinct values:test_color_single_qubit_noise_probabilities_follow_pauli_labels(renamed..._follow_basis_labels) andtest_color_stim_and_dem_data_noise_locations_match.unittest discover528 tests, 57 skipped, 1 failure (test_required_model_files_present, pretrained weights not present locally);pyteston the color tests 315 passed, 11 skipped;yapfclean.🤖 Generated with Claude Code